package com.ruoyi.ruoyictmanage.domain.entity;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;

import java.util.ArrayList;
import java.util.List;

public class CT {
    @ExcelProperty("MPN编号")
    private long MPN_id;
    @ExcelIgnore
    private long CT_id;
    @ExcelProperty("基准CT")
    private double benchmark_value;
    @ExcelProperty("测定日期")
    private String enter_data;
    @ExcelIgnore
    private List<String> test_values;
    // 新增10个字段用于Excel映射
    @ExcelProperty("参数1")
    private String param1;

    @ExcelProperty("参数2")
    private String param2;

    @ExcelProperty("参数3")
    private String param3;

    @ExcelProperty("参数4")
    private String param4;

    @ExcelProperty("参数5")
    private String param5;

    @ExcelProperty("参数6")
    private String param6;

    @ExcelProperty("参数7")
    private String param7;

    @ExcelProperty("参数8")
    private String param8;

    @ExcelProperty("参数9")
    private String param9;

    @ExcelProperty("参数10")
    private String param10;
    @ExcelProperty("异常原因")
    private String exception_cause;
    @ExcelProperty("对策措施")
    private String countermeasure;
    @ExcelProperty("纳期")
    private String acceptance;
    @ExcelProperty("NPI")
    private String NPI;
    @ExcelProperty("process")
    private String process;
    @ExcelProperty("IE")
    private String IE;
    @ExcelProperty("复合表组合名称")
    private String ic_name;
    @ExcelProperty("长度宽幅")
    private String DFF;
    @ExcelProperty("psc/sheet")
    private String psc_sheet;
    @ExcelProperty("设备配置")
    private String device_config;
    @ExcelProperty("部门名称")
    private String dept_name;
    @ExcelProperty("课别名称")
    private String class_name;
    @ExcelProperty("楼层")
    private String floor;
    @ExcelProperty("BU")
    private String bu;

    public CT() {
    }

    public CT(long CT_id, double benchmark_value, String enter_data, List<String> test_values, long MPN_id, String exception_cause, String countermeasure, String acceptance, String NPI, String process, String IE, String ic_name, String DFF, String psc_sheet, String device_config, String dept_name, String class_name, String floor, String bu) {
        this.CT_id = CT_id;
        this.benchmark_value = benchmark_value;
        this.enter_data = enter_data;
        this.test_values = test_values;
        this.MPN_id = MPN_id;
        this.exception_cause = exception_cause;
        this.countermeasure = countermeasure;
        this.acceptance = acceptance;
        this.NPI = NPI;
        this.process = process;
        this.IE = IE;
        this.ic_name = ic_name;
        this.DFF = DFF;
        this.psc_sheet = psc_sheet;
        this.device_config = device_config;
        this.dept_name = dept_name;
        this.class_name = class_name;
        this.floor = floor;
        this.bu = bu;
    }

    // 导出前：将List拆分为10列
    public void splitListToColumns() {
        if (test_values != null) {
            // 确保至少有10个元素（不足补空字符串）
            while (test_values.size() < 10) {
                test_values.add("");
            }

            // 分配到各列
            param1 = test_values.size() > 0 ? test_values.get(0) : "";
            param2 = test_values.size() > 1 ? test_values.get(1) : "";
            param3 = test_values.size() > 2 ? test_values.get(2) : "";
            param4 = test_values.size() > 3 ? test_values.get(3) : "";
            param5 = test_values.size() > 4 ? test_values.get(4) : "";
            param6 = test_values.size() > 5 ? test_values.get(5) : "";
            param7 = test_values.size() > 6 ? test_values.get(6) : "";
            param8 = test_values.size() > 7 ? test_values.get(7) : "";
            param9 = test_values.size() > 8 ? test_values.get(8) : "";
            param10 = test_values.size() > 9 ? test_values.get(9) : "";
        }
    }

    // 导入后：将10列合并为List
    public void combineColumnsToList() {
        test_values = new ArrayList<>();
        if (param1 != null) test_values.add(param1);
        if (param2 != null) test_values.add(param2);
        if (param3 != null) test_values.add(param3);
        if (param4 != null) test_values.add(param4);
        if (param5 != null) test_values.add(param5);
        if (param6 != null) test_values.add(param6);
        if (param7 != null) test_values.add(param7);
        if (param8 != null) test_values.add(param8);
        if (param9 != null) test_values.add(param9);
        if (param10 != null) test_values.add(param10);

        // 移除尾部空值
        while (!test_values.isEmpty() &&
                test_values.get(test_values.size() - 1).isEmpty()) {
            test_values.remove(test_values.size() - 1);
        }
    }

    public long getCT_id() {
        return CT_id;
    }

    public void setCT_id(long CT_id) {
        this.CT_id = CT_id;
    }

    public double getBenchmark_value() {
        return benchmark_value;
    }

    public void setBenchmark_value(double benchmark_value) {
        this.benchmark_value = benchmark_value;
    }

    public String getEnter_data() {
        return enter_data;
    }

    public void setEnter_data(String enter_data) {
        this.enter_data = enter_data;
    }

    public String  getTest_values() {
        return test_values+"";
    }

    public void setTest_values(List<String>  test_values) {
        this.test_values = test_values;
    }

    public long getMPN_id() {
        return MPN_id;
    }

    public void setMPN_id(long MPN_id) {
        this.MPN_id = MPN_id;
    }

    public String getException_cause() {
        return exception_cause;
    }

    public void setException_cause(String exception_cause) {
        this.exception_cause = exception_cause;
    }

    public String getCountermeasure() {
        return countermeasure;
    }

    public void setCountermeasure(String countermeasure) {
        this.countermeasure = countermeasure;
    }

    public String getAcceptance() {
        return acceptance;
    }

    public void setAcceptance(String acceptance) {
        this.acceptance = acceptance;
    }

    public String getNPI() {
        return NPI;
    }

    public void setNPI(String NPI) {
        this.NPI = NPI;
    }

    public String getProcess() {
        return process;
    }

    public void setProcess(String process) {
        this.process = process;
    }

    public String getIE() {
        return IE;
    }

    public void setIE(String IE) {
        this.IE = IE;
    }

    public String getIc_name() {
        return ic_name;
    }

    public void setIc_name(String ic_name) {
        this.ic_name = ic_name;
    }

    public String getDFF() {
        return DFF;
    }

    public void setDFF(String DFF) {
        this.DFF = DFF;
    }

    public String getPsc_sheet() {
        return psc_sheet;
    }

    public void setPsc_sheet(String psc_sheet) {
        this.psc_sheet = psc_sheet;
    }

    public String getDevice_config() {
        return device_config;
    }

    public void setDevice_config(String device_config) {
        this.device_config = device_config;
    }

    public String getDept_name() {
        return dept_name;
    }

    public void setDept_name(String dept_name) {
        this.dept_name = dept_name;
    }

    public String getClass_name() {
        return class_name;
    }

    public void setClass_name(String class_name) {
        this.class_name = class_name;
    }

    public String getFloor() {
        return floor;
    }

    public void setFloor(String floor) {
        this.floor = floor;
    }

    public String getBu() {
        return bu;
    }

    public void setBu(String bu) {
        this.bu = bu;
    }

    public String getParam1() {
        return param1;
    }

    public void setParam1(String param1) {
        this.param1 = param1;
    }

    public String getParam2() {
        return param2;
    }

    public void setParam2(String param2) {
        this.param2 = param2;
    }

    public String getParam3() {
        return param3;
    }

    public void setParam3(String param3) {
        this.param3 = param3;
    }

    public String getParam4() {
        return param4;
    }

    public void setParam4(String param4) {
        this.param4 = param4;
    }

    public String getParam5() {
        return param5;
    }

    public void setParam5(String param5) {
        this.param5 = param5;
    }

    public String getParam6() {
        return param6;
    }

    public void setParam6(String param6) {
        this.param6 = param6;
    }

    public String getParam7() {
        return param7;
    }

    public void setParam7(String param7) {
        this.param7 = param7;
    }

    public String getParam8() {
        return param8;
    }

    public void setParam8(String param8) {
        this.param8 = param8;
    }

    public String getParam9() {
        return param9;
    }

    public void setParam9(String param9) {
        this.param9 = param9;
    }

    public String getParam10() {
        return param10;
    }

    public void setParam10(String param10) {
        this.param10 = param10;
    }

    @Override
    public String toString() {
        return "CT{" +
                "CT_id=" + CT_id +
                ", benchmark_value=" + benchmark_value +
                ", enter_data='" + enter_data + '\'' +
                ", test_values=" + test_values +
                ", param1='" + param1 + '\'' +
                ", param2='" + param2 + '\'' +
                ", param3='" + param3 + '\'' +
                ", param4='" + param4 + '\'' +
                ", param5='" + param5 + '\'' +
                ", param6='" + param6 + '\'' +
                ", param7='" + param7 + '\'' +
                ", param8='" + param8 + '\'' +
                ", param9='" + param9 + '\'' +
                ", param10='" + param10 + '\'' +
                ", MPN_id=" + MPN_id +
                ", exception_cause='" + exception_cause + '\'' +
                ", countermeasure='" + countermeasure + '\'' +
                ", acceptance='" + acceptance + '\'' +
                ", NPI='" + NPI + '\'' +
                ", process='" + process + '\'' +
                ", IE='" + IE + '\'' +
                ", ic_name='" + ic_name + '\'' +
                ", DFF='" + DFF + '\'' +
                ", psc_sheet='" + psc_sheet + '\'' +
                ", device_config='" + device_config + '\'' +
                ", dept_name='" + dept_name + '\'' +
                ", class_name='" + class_name + '\'' +
                ", floor='" + floor + '\'' +
                ", bu='" + bu + '\'' +
                '}';
    }
}
